﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

public class Shape : MoveAbleNode
{
    private ShapeType type;

    public Shape()
    {
        X3D.LoadXml("<Shape></Shape>");
        shapeType = ShapeType.Box;
    }

    public Shape(ShapeType st)
    {
        X3D.LoadXml("<Shape></Shape>");
        shapeType =st;        
    }

    public ShapeType shapeType
    {
        get
        {
            return type;
        }
        set
        {
            type = value;
        }
    }

    public double[] Size
    {
        get
        {
            throw new System.NotImplementedException();
        }
        set
        {
        }
    }

    public new XmlDocument writeToXML()
    {
        XmlNode xn=null;
        switch (shapeType)
        {
            case ShapeType.Box:
                xn = X3D.CreateNode(XmlNodeType.Element, "Box", "");
                break;
            case ShapeType.Cone:
                xn = X3D.CreateNode(XmlNodeType.Element, "Cone", "");
                break;
            case ShapeType.Sphere:
                xn = X3D.CreateNode(XmlNodeType.Element, "Sphere", "");
                break;
            case ShapeType.Cylinder:
                xn = X3D.CreateNode(XmlNodeType.Element, "Cylinder", "");
                break;
            default:
                return null;

        }
        
        X3D.FirstChild.AppendChild(xn);
        return X3D;
        //throw new System.NotImplementedException();

    }
}
